package com.sfac.javaSpringBoot.modules.common.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

@JsonFormat(shape= JsonFormat.Shape.OBJECT)
public enum ImageType {
    SMALL_IMAGE("small-image", 128, 128, 50),
    MIDDLE_IMAGE("middle-image", 150, 150, 100),
    BIG_IMAGE("big-image", 220, 220, 200),
    ;
    public String name;
    public int length;
    public int width;
    public int size;

    ImageType(String name, int length, int width, int size) {
        this.name = name;
        this.length = length;
        this.width = width;
        this.size = size;
    }

    public static ImageType getImageTypeByName(String imageTypeName) {
        for (ImageType imageType : ImageType.values()) {
            if (imageType.name.equals(imageTypeName)) {
                return imageType;
            }
        }
        return null;
    }

    public static void main(String[] args) {
        System.out.println(ImageType.getImageTypeByName("middle-image"));
    }
}